package com.xinke.module.system.mapper.mail;

import java.util.*;

import com.xinke.component.common.pojo.PageResult;
import com.xinke.component.mybatis.mybatis.core.query.LambdaQueryWrapperExt;
import com.xinke.component.mybatis.mybatis.core.mapper.BaseMapperExt;
import com.xinke.module.system.model.entity.mail.MailTemplateDO;
import org.apache.ibatis.annotations.Mapper;
import com.xinke.module.system.model.vo.mail.*;

/**
 * 邮件模版 Mapper
 *
 * @author yzx
 */
@Mapper
public interface MailTemplateMapper extends BaseMapperExt<MailTemplateDO> {

    default PageResult<MailTemplateDO> selectPage(MailTemplatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperExt<MailTemplateDO>()
                .likeIfPresent(MailTemplateDO::getTemplateName, reqVO.getTemplateName())
                .eqIfPresent(MailTemplateDO::getTemplateCode, reqVO.getTemplateCode())
                .eqIfPresent(MailTemplateDO::getMailAcctId, reqVO.getMailAcctId())
                .likeIfPresent(MailTemplateDO::getTemplateNickName, reqVO.getTemplateNickName())
                .eqIfPresent(MailTemplateDO::getTemplateTitle, reqVO.getTemplateTitle())
                .eqIfPresent(MailTemplateDO::getTemplateContent, reqVO.getTemplateContent())
                .eqIfPresent(MailTemplateDO::getTemplateParams, reqVO.getTemplateParams())
                .eqIfPresent(MailTemplateDO::getTemplateStatus, reqVO.getTemplateStatus())
                .eqIfPresent(MailTemplateDO::getRemark, reqVO.getRemark())
                .orderByDesc(MailTemplateDO::getTemplateId));
    }

}